function getData(key){
  return JSON.parse(sessionStorage.getItem(key)) 
}
function showData(data){
    $('#mydiv').html('')
    $('#mydiv').append(`
    <div class="container-fluid">
    <div class="col-md-2 item">
      <span>装备信息:</span> <span>${data.bianhao}</span>
    </div>
    <div class="col-md-2 item">
      <span>装备名称:</span> <span>${data.mingcheng}</span>
    </div>
    <div class="col-md-2 item">
      <span>分类:</span> <span>${data.fenlei}</span>
    </div>
    <div class="col-md-2 item">
      <span>装备状态:</span> <span>${data.state}</span>
    </div>
    <div class="col-md-2 item">
      <span>投运日期:</span> <span>${data.riqi}</span>
    </div>
    </div>


    <div class="container-fluid">
    <div class="col-md-2 item">
      <span>价格:</span> <span>${data.price}</span>
    </div>
    <div class="col-md-2 item">
      <span>筹措方式:</span><span>${data.way}</span>
    </div>
    <div class="col-md-2 item">
      <span>使用单位:</span><span>${data.unit}</span>
    </div>
    <div class="col-md-2 item">
      <span>存放位置:</span><span>${data.location}</span>
    </div>
    <div class="col-md-2 item">
      <span>责任人:</span><span>${data.name}</span>
    </div>
    </div>`)
 
    }
    showData(getData('kay'))
    let menu1=[
      {biaohao:'582245',mingcheng:'油泵',leixing:'发动机配件',wx:'是'},
      {biaohao:'522245',mingcheng:'火花塞',leixing:'电气配件',wx:'否'},
      {biaohao:'572245',mingcheng:'油泵',leixing:'发动机配件',wx:'是'},
      {biaohao:'584235',mingcheng:'油泵',leixing:'发动机配件',wx:'否'},
      {biaohao:'482245',mingcheng:'火花塞',leixing:'电气配件',wx:'是'},
      {biaohao:'382245',mingcheng:'油泵',leixing:'发动机配件',wx:'否'},
    ]
    let menu2=[
      {kaishi:'2020/05/13',jieshu:'2020/5/13',fuzeren:'赵四',guzhang:'发动机启动不了',},
      {kaishi:'2020/05/13',jieshu:'2020/5/13',fuzeren:'赵四',guzhang:'发动机启动不了',},
      {kaishi:'2020/05/13',jieshu:'2020/5/13',fuzeren:'赵四',guzhang:'发动机启动不了',},
      {kaishi:'2020/05/13',jieshu:'2020/5/13',fuzeren:'赵四',guzhang:'发动机启动不了',},
      {kaishi:'2020/05/13',jieshu:'2020/5/13',fuzeren:'赵四',guzhang:'发动机启动不了',},
      {kaishi:'2020/05/13',jieshu:'2020/5/13',fuzeren:'赵四',guzhang:'发动机启动不了',},
      {kaishi:'2020/05/13',jieshu:'2020/5/13',fuzeren:'赵四',guzhang:'发动机启动不了',},
    ]
    let menu3=[
      {mingcheng:'维修手册',leibie:'装备保障'},
      {mingcheng:'保养手册',leibie:'装备保障'},
      {mingcheng:'维修手册',leibie:'装备保障'},
      {mingcheng:'保养手册',leibie:'装备保障'},
      {mingcheng:'维修手册',leibie:'装备保障'},
      {mingcheng:'保养手册',leibie:'装备保障'},
      {mingcheng:'维修手册',leibie:'装备保障'},
      {mingcheng:'保养手册',leibie:'装备保障'},
      {mingcheng:'维修手册',leibie:'装备保障'},
      {mingcheng:'保养手册',leibie:'装备保障'},
    ]
    function showMenu1(data){
      $('#table').html('')
      $('#table').append(`
      <thead>
      <tr>
        <th class="col-md-3 item">器材编号</th>
        <th class="col-md-3 item">器材名称</th>
        <th class="col-md-3 item">器材类型</th>
        <th class="col-md-3 item">是否维修</th>
      </tr>
    </thead>
      `)
      $.each(data,(index,item)=>{
        $('#table').append(`
        <tbody>
          <tr>
            <td class="col-md-3 item">${item.biaohao}</td>
            <td class="col-md-3 item">${item.mingcheng}</td>
            <td class="col-md-3 item">${item.leixing}</td>
            <td class="col-md-3 item">${item.wx}</td>
          </tr>
        </tbody>
        `)
      })
    }
    function showMenu2(data){
      $('#table').html('')
      $('#table').append(`
      <thead>
      <tr>
        <th class="col-md-2 item">开始时间</th>
        <th class="col-md-2 item">结束时间</th>
        <th class="col-md-3 item">负责人</th>
        <th class="col-md-3 item">故障描述</th>
        <th class="col-md-2 item">操作</th>
      </tr>
    </thead>
      `)
      $.each(data,(index,item)=>{
        $('#table').append(`
        <tbody>
          <tr>
            <td class="col-md-2 item">${item.kaishi}</td>
            <td class="col-md-2 item">${item.jieshu}</td>
            <td class="col-md-3 item">${item.fuzeren}</td>
            <td class="col-md-3 item">${item.guzhang}</td>
            <td class="col-md-2 item"><span class="glyphicon glyphicon-eye-open chakan" aria-hidden="true"></span></td>
          </tr>
        </tbody>
        `)
      })
    }
    
    function showMenu3(data){
      $('#table').html('')
      $('#table').append(`
      <thead>
      <tr>
        <th class="col-md-4 item">资料名称</th>
        <th class="col-md-4 item">专业类别</th>
        <th class="col-md-4 item">操作</th>
      
      </tr>
    </thead>
      `)
      $.each(data,(index,item)=>{
        $('#table').append(`
        <tbody>
          <tr>
            <td class="col-md-4 item">${item.mingcheng}</td>
            <td class="col-md-4 item">${item.leibie}</td>
            <td class="col-md-4 item">
            <span class="glyphicon glyphicon-eye-open chakan" aria-hidden="true"></span>
            <span class="glyphicon glyphicon-download-alt xiazai" aria-hidden="true"></span>
            </td>
          </tr>
        </tbody>
        `)
      })
    }
    showMenu1(menu1)
    $('#qc').click(function (){
     showMenu1(menu1)
     $('#qc').css({"color":"white", "background-color": "#6554C0"})
     $('#wx').css({"color":"#6554C0", "background-color": "#E7E6F5"})
     $('#js').css({"color":"#6554C0", "background-color": "#E7E6F5"})
    })
    $('#wx').click(function (){
      showMenu2(menu2)
      $('#qc').css({"color":"#6554C0", "background-color": "#E7E6F5"})
      $('#wx').css({"color":"white", "background-color": "#6554C0"})
      $('#js').css({"color":"#6554C0", "background-color": "#E7E6F5"})
    })
    $('#js').click(function (){
      showMenu3(menu3)
      $('#qc').css({"color":"#6554C0", "background-color": "#E7E6F5"})
      $('#wx').css({"color":"#6554C0", "background-color": "#E7E6F5"})
      $('#js').css({"color":"white", "background-color": "#6554C0"})
    }) 

    $('#fanhui').click(function (){
      window.location.href="EquipmentManagement.html"
    })